n, m = map(int, input().split())
nums = list(map(int, input().split()))


def f(num):
    p = num
    q = 0
    while p:
        q <<= 1
        q += p & 1
        p >>= 1
    return num, q


nums2 = [f(s) for s in nums]
print(nums2)
